package com.xh.bussiness.course.bean.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xh.core.model.SuperEntity;
import com.xh.core.util.StringUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;

@Data
public class PrepareLessonScoreDto{

    /**
     * 备课id
     */
    @NotNull(message = "备课id不能为空")
    private String  prepareLessonId;
    /**
     * 教学目标
     */
    private Double teachTarget;
    /**
     *教学过程
     */
    private Double teachProcess;
    /**
     * 教学准备
     */
    private Double teachPlan;
    /**
     * 板书设计
     */
    private Double templatePlan;
    /**
     * 教师反思
     */
    private Double teacherRethink;
    /**
     *情境导入
     */
    private Double situationImport;
    /**
     * 还课评分-教学目标
     */
    private Double videoTeachTarget;
    /**
     * 教学过程与方法
     */
    private Double teachProcessMethod;
    /**
     * 教学效果
     */
    private Double teachResult;
    /**
     * 教学基本功
     */
    private Double teachBasicTraining;
    /**
     * 备课质量评分
     */
    private Double teachePlanScore;
    /**
     * 还课评分
     */
    private Double videoScore;

    private Integer checkStatus;

    private String refuseContent;

    private String refuseReason;

    private List<String> refuseContents;

    public Double getTotalScore() {
        Double totalScore = 0.0;
        if(this.teachTarget != null){
            totalScore += teachTarget;
        }
        if(this.teachProcess != null){
            totalScore += teachProcess;
        }
        if(this.teachPlan != null){
            totalScore += teachPlan;
        }
        if(this.templatePlan != null){
            totalScore += templatePlan;
        }
        if(this.teacherRethink != null){
            totalScore += teacherRethink;
        }
        if(this.situationImport != null){
            totalScore += situationImport;
        }
        if(this.videoTeachTarget != null){
            totalScore += videoTeachTarget;
        }
        if(this.teachProcessMethod != null){
            totalScore += teachProcessMethod;
        }
        if(this.teachResult != null){
            totalScore += teachResult;
        }
        if(this.teachBasicTraining != null){
            totalScore += teachBasicTraining;
        }
        return totalScore;
    }

    public Double getTeachePlanScore() {
        teachePlanScore = 0.0;
        if(this.teachTarget != null){
            teachePlanScore += teachTarget;
        }
        if(this.teachProcess != null){
            teachePlanScore += teachProcess;
        }
        if(this.teachPlan != null){
            teachePlanScore += teachPlan;
        }
        if(this.templatePlan != null){
            teachePlanScore += templatePlan;
        }
        if(this.teacherRethink != null){
            teachePlanScore += teacherRethink;
        }
        return teachePlanScore;
    }

    public Double getVideoScore() {
        videoScore = 0.0;
        if(this.situationImport != null){
            videoScore += situationImport;
        }
        if(this.videoTeachTarget != null){
            videoScore += videoTeachTarget;
        }
        if(this.teachProcessMethod != null){
            videoScore += teachProcessMethod;
        }
        if(this.teachResult != null){
            videoScore += teachResult;
        }
        if(this.teachBasicTraining != null){
            videoScore += teachBasicTraining;
        }
        return videoScore;
    }

    public List<String> getRefuseContents() {
        if(StringUtils.isNotEmpty(this.refuseContent)){
            return Arrays.asList(this.refuseContent.split(","));
        }
        return refuseContents;
    }
}
